package Part5_Annotation;

import java.lang.reflect.Field;

/**
 * ClassName: Test
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.05.09 15:55
 */
public class Test {
    @org.junit.Test
    public void test1(){
        Class<Customer> customerClass = Customer.class;
        Table annotation = customerClass.getDeclaredAnnotation(Table.class);

        System.out.println(annotation.value());

    }

    @org.junit.Test
    public void test2() throws NoSuchFieldException {
        Class<Customer> customerClass = Customer.class;
        Field name = customerClass.getDeclaredField("name");

        Column annotation = name.getDeclaredAnnotation(Column.class);

        System.out.println(annotation.columnName());
        System.out.println(annotation.columnType());//不知为何空指针异常

    }
}
